﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.RB
{
    class Class15
    {

        public void Calc0(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age < 70)
            {
                ppa.Amount = ppa.PolicyActing.Policy.Amount * 1.5;
            }
            else
            {
                ppa.Amount = ppa.PolicyActing.Policy.Amount;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("重疾"))
            {
                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                    ppa.IsCurrentFinish = true;
                }
                else if(ppa.Period==1)
                {
                    da.Value = ppa.TotalFee * 1.2;
                    ppa.IsCurrentFinish = true;
                }
                else if (ppa.Period >= 2)
                {
                    da.Value = ppa.Amount * 2;
                    ppa.Fee = 0;
                }
                
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                }
                else if (ppa.Period == 1)
                {
                    da.Value = ppa.TotalFee * 1.2;
                    
                }
                else if (ppa.Period >= 2)
                {
                    da.Value = (ppa.Amount * 3) - ppa.GetDutyTotalValue("重大疾病保险金");
                }
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("高度残疾"))
            {
                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee;
                }
                else if (ppa.Period == 1)
                {
                    da.Value = ppa.TotalFee * 1.2;

                }
                else if (ppa.Period >= 2)
                {
                    da.Value = (ppa.Amount * 3) - ppa.GetDutyTotalValue("重大疾病保险金");
                }
                ppa.IsCurrentFinish = true;
            }

        }
    }
}
